package model

import (
	"gitee.com/xuxinzhi2206/corehub/database/mysql"
	"gorm.io/gorm"
)

type Order struct {
	gorm.Model
	OrderId int64  `gorm:"type:int(11);comment:订单id"`
	GoodId  int64  `gorm:"type:int(11);comment:商品id"`
	On      string `gorm:"type:int(11);comment:On"`
}

func (o *Order) CreateOrder() error {
	return mysql.WithMysql(func(db *gorm.DB) error {
		return db.Create(&o).Error
	})
}
func (o *Order) GetOrder() error {
	return mysql.WithMysql(func(db *gorm.DB) error {
		return db.Where("ID = ?", o.OrderId).First(&o).Error
	})
}
